import {TemplateRef} from '@angular/core';

export type Func = (data?: any) => void;
export interface ConfirmConfig {
  title?: string;
  msg?: string;
  icon?: string;
  yesLabel?: string;
  yesIcon?: string;
  noLabel?: string;
  noIcon?: string;
  showYes?: boolean;
  showNo?: boolean;
  width?: number;
  height?: number;
  yesStyle?: any;
  noStyle?: any;
  yes?: Func;
  no?: Func;
}
export class BaseModel {}

export class Dictionary extends BaseModel {
  constructor() { super(); }
  public parentId: string;
  public value: string;
  public label: string;
  public useForTable: string;
  public useForField: string;
  public sortNo: number;
}

export class LoginUser {
  constructor(
    private userName: string,
    private userPwd: string
  ) {}
}

export class GrowlMsg {
  constructor(
    public severity: string,
    public summary: string,
    public detail: string,
  ) {}
}

export interface IPDialogConfig {
  header?: string;
  display?: boolean;
  width?: string;
  top?: string;
  left?: string;
  yes?: Func;
  no?: Func;

}
export interface IPDialogData {
  inData: any;
  outData: any;
  model: any;
  other: any;
}
export interface IPDialog {
  config?: IPDialogConfig;   // Dialog的配置信息，如标题，宽度，位置，是否显示
  data?: IPDialogData;  // 传入的对象值，
  content?: TemplateRef<any>;
}
export class PDialog {
  config?: IPDialogConfig;   // Dialog的配置信息，如标题，宽度，位置，是否显示
  data?: IPDialogData;  // 传入的对象值，
  show(config?: IPDialogConfig, data?: IPDialogData) {
    if (config) {
      this.config = config;
    }
    if (data) {
      this.data = data;
    }
    this.config.display = true;
  }
}


